// // 泛型将类型变成了一个参数
// function sayHi<T>(msg: T): T {
//   return msg
// }

// let res = sayHi<string>('hello')
// let res2 = sayHi<number>(1234234)



// type Ianonymity = <T>(input: T) => T;
// const func: Ianonymity = <T>(input: T) => {
//   return input
// }
// let res3 = func<number>(233)
// console.log(res3);




interface GenericIdentityFn<T> {
  (arg: T): T;
}

function identity<T>(arg: T): T {
  console.log(arg);
  return arg;
}

let myIdentity: GenericIdentityFn<number> = identity;
myIdentity(1234)



interface ISize {
  size: string
}
// 限制类型中必须有一个size属性
function trace<T extends ISize>(arg: T): T {
  console.log(arg.size);
  return arg;
}
trace({size: '555'})

export {}